package com.xyy.ec.pop.api.kingdinggmp.task;


import com.xyy.ec.pop.api.kingdinggmp.service.PopErpTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@EnableAsync
public class MyScheduledTask {

    @Autowired
    private PopErpTaskService popService;


    /**
     * 商品全量任务
     */
    @Async
    @Scheduled(cron = "0 0 * * * ? ")
    @PostConstruct
    public void productToPopTask() {
        popService.syncProductFullToPop();
    }

    /**
     * 库存
     */
    @Async
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void productStockToPopTask() {
        popService.syncProductStockToPop();
    }

    /**
     * 价格
     */
    @Async
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void productPriceToPopTask() {
        popService.syncProductPriceToPop();
    }

    /**
     * 客户信息上报
     */
    @Async
    @Scheduled(cron = "0 0/5 * * * ? ")
    public void clientInfToPopTask() {
        popService.syncCustomerToPop();
    }

    /**
     * 客户信息导入
     */
    @Async
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void clientInfoToErpTask() {
        popService.syncNoneOpenCustomerToMerchant();
    }

    /**
     * 订单导入
     */
    @Async
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void popOrderAutoErp() {
        popService.syncOrderToMerchant();
    }

    /**
     * 出库明细
     */
    @Async
    @Scheduled(cron = "0 0/3 * * * ? ")
    public void erpOrderpop() {
        popService.syncOrderStatePop();
    }


}
